package com.ytd.common.util;

import java.util.Calendar;
import java.util.Date;

/**
 * Your class notes
 *
 * @author gaoguanchao
 * @since 2023/4/23
 */
public class DateUtil {

    public static boolean isNowEffectiveDate(String startTime, String endTime) {
        String format = FormatUtil.getNowMealTimeString();
        if (format.equals(startTime)) {
            return true;
        }
        Date parseStart = FormatUtil.parseMealTime(startTime);
        Date parseEnd = FormatUtil.parseMealTime(endTime);
        Date parseNow = FormatUtil.parseMealTime(format);
        Calendar date = Calendar.getInstance();
        date.setTime(parseNow);

        Calendar begin = Calendar.getInstance();
        begin.setTime(parseStart);

        Calendar end = Calendar.getInstance();
        end.setTime(parseEnd);

        if (date.after(begin) && date.before(end)) {
            return true;
        } else {
            return false;
        }
    }
}
